
/**
 * 功能：用户登陆拦截器	 
 * -------------------------------------------------------------------------
 * Copyright (c) recency.cy    创建日期:2011-5-31 修改:2011-5-31
 */

package com.roc.web.interceptor;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.apache.struts2.StrutsStatics;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import com.roc.pojo.Operators;
import com.roc.util.constant.Constant;
import com.roc.web.action.LoginAction;

public class LoginInteceptor extends AbstractInterceptor {

	private static final long serialVersionUID = -3629419005448967788L;
	private static Logger logger = LogManager.getLogger(LoginInteceptor.class);
	@SuppressWarnings({ "rawtypes" })
	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		Map session = invocation.getInvocationContext().getSession();
		Operators merchant = (Operators) session.get(Constant.SESSION_LOGIN_MERCHANT);
		
		if (merchant == null) {
			//logger.info("----struts2拦截器拦截账号为空------");
			return Action.LOGIN;
		}/*else{
			logger.info("----struts2拦截器拦截账号["+merchant.getAccountNo()+"]-");
		}*/
		return invocation.invoke();
	}
}
